import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class rotate_array {
        public  void rotate(int[] nums, int k) {
            int n = nums.length;
            int[] newArr = new int[n];
            for (int i = 0; i < n; ++i) {
                newArr[(i + k) % n] = nums[i];
            }
            System.arraycopy(newArr, 0, nums, 0, n);
        }

    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6,7};
        rotate_array array = new rotate_array();
        Scanner scanner = new Scanner(System.in);
        int k = scanner.nextInt();
        array.rotate(arr,3);
        System.out.println(Arrays.toString(arr));
    }

}
